package edu.hawaii.ics414.blackjack.practiceMode;

import edu.hawaii.ics414.blackjack.card.Card;
import edu.hawaii.ics414.blackjack.player.Dealer;
import edu.hawaii.ics414.blackjack.player.Player;
import java.util.Scanner;

@Deprecated
public class Split {
	String choice = "";
	Scanner s = new Scanner(System.in);

	public void split(Player player, Dealer dealer, int pot){
/*	  
		while(player.hand1ok && player.hand2ok && player.hand3ok && player.hand4ok){
			//if the first hand gets a pair
			if(player.hand1[0].getRank().toString().compareTo(player.hand1[1].getRank().toString()) == 0){
				if(player.money > 0){
					while(!choice.equalsIgnoreCase("Y") && !choice.equalsIgnoreCase("N")){
						System.out.print("Would you like to split your hand?  Y/N");
						choice = s.nextLine();
						if(choice.equalsIgnoreCase("Y")){
							splitHand(player.hand1, player.hand2, dealer);
							Bet.bet(player, pot);
						} else if (choice.equalsIgnoreCase("N")){
							System.out.println("You chose not to split your hand.");
						} else {
							System.out.println("Invalid Option!");
						}
					}
				}
			}
			//then, if player gets pairs after the split
			if((player.hand1[0].getRank().toString().compareTo(player.hand1[1].getRank().toString() == 0) 
			 || player.hand2[0].getRank().toString().compareTo(player.hand2[1].getRank().toString())) == 0){
				//hand 1 has a pair
				if (player.hand1[0].getRank().toString().compareTo(player.hand1[1].getRank().toString()) == 0){
					if(player.money > 0){
						while(!choice.equalsIgnoreCase("Y") && !choice.equalsIgnoreCase("N")){
							System.out.print("Would you like to split your first hand?  Y/N");
							choice = s.nextLine();
							if(choice.equalsIgnoreCase("Y")){
								splitHand(player.hand1, player.hand3, dealer);
								Bet.bet(player, pot);
							} else if (choice.equalsIgnoreCase("N")){
								System.out.println("You chose not to spilt your hand.");
							} else {
								System.out.println("Invalid Option!");
							}
						}
					}
				} 
				//hand 2 has a pair
				else {
					if(player.money > 0){
						while(!choice.equalsIgnoreCase("Y") && !choice.equalsIgnoreCase("N")){
							System.out.print("Would you like to split your second hand?  Y/N");
							choice = s.nextLine();
							if(choice.equalsIgnoreCase("Y")){
								splitHand(player.hand2, player.hand3, dealer);
								Bet.bet(player, pot);
							} else if (choice.equalsIgnoreCase("N")){
								System.out.println("You chose not to spilt of your hand.");
							} else {
								System.out.println("Invalid Option!");
							}
						}
					}
				} 
			}
			//when the player has three hands
			if(player.hand1[0].getRank().toString().compareTo(player.hand1[1].getRank().toString()) == 0 
			|| player.hand2[0].getRank().toString().compareTo(player.hand2[1].getRank().toString()) == 0
			|| player.hand3[0].getRank().toString().compareTo(player.hand3[1].getRank().toString()) == 0){
				//if hand 1 has a pair
				if(player.hand1[0].getRank().toString().compareTo(player.hand1[1].getRank().toString()) == 0){
					if(player.money > 0){
						while(!choice.equalsIgnoreCase("Y") && !choice.equalsIgnoreCase("N")){
							System.out.print("Would you like to split your first hand?  Y/N");
							choice = s.nextLine();
							if(choice.equalsIgnoreCase("Y")){
								splitHand(player.hand1, player.hand4, dealer);
								Bet.bet(player, pot);
							} else if (choice.equalsIgnoreCase("N")){
								System.out.println("You chose not to spilt your hand.");
							} else {
								System.out.println("Invalid Option!");
							}
						}
					}
				//if hand 2 has a pair
				} else if(player.hand2[0].getRank().toString().compareTo(player.hand2[1].getRank().toString()) == 0){
					if(player.money > 0){
						while(!choice.equalsIgnoreCase("Y") && !choice.equalsIgnoreCase("N")){
							System.out.print("Would you like to split your second hand?  Y/N");
							choice = s.nextLine();
							if(choice.equalsIgnoreCase("Y")){
								splitHand(player.hand2, player.hand4, dealer);
								Bet.bet(player, pot);
							} else if (choice.equalsIgnoreCase("N")){
								System.out.println("You chose not to spilt your hand.");
							} else {
								System.out.println("Invalid Option!");
							}
						}
					}
				//if hand 3 has a pair
				} else {
					if(player.money > 0){
						while(!choice.equalsIgnoreCase("Y") && !choice.equalsIgnoreCase("N")){
							System.out.print("Would you like to split your third hand?  Y/N");
							choice = s.nextLine();
							if(choice.equalsIgnoreCase("Y")){
								splitHand(player.hand3, player.hand4, dealer);
								Bet.bet(player, pot);
							} else if (choice.equalsIgnoreCase("N")){
								System.out.println("You chose not to spilt your hand.");
							} else {
								System.out.println("Invalid Option!");
							}
						}
					}
				}
			}
		}
*/
	}
	
	public void splitHand(Card[] handBeingSplit, Card[] emptyHand, Dealer dealer){
/*	  
		emptyHand[0] = handBeingSplit[1];
		handBeingSplit[1] = dealer.draw();
		emptyHand[1] = dealer.draw();
*/
	}
}
